﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// Added
using System.Xml;
using System.IO;

namespace GameEditor
{
    public static class GEConfig
    {
        private const String configFilePath = "./GEConfig.xml";
        public const String langPath = "./Lang/";

        #region "variables"
        private static XmlDocument confFile;
        private static String lang;

        #endregion

        #region "Properties"
        public static String defaultLanguage { get { return lang; } }

        #endregion

        public static void loadConfig()
        {
            confFile = new XmlDocument();
            confFile.Load(configFilePath);

            // put every info in corresponding variable
            lang= confFile.GetElementsByTagName("DefaultLanguage")[0].InnerText;
        }

        /// <summary>
        /// Change value of the specified field
        /// </summary>
        /// <param name="Field">Field</param>
        /// <param name="Text"></param>
        public static void changeField(String Field, String Text)
        {
            // TODO : changeField
            XmlNode langNode = confFile.GetElementsByTagName(Field)[0];
            langNode.InnerText = Text;

            confFile.Save(configFilePath);
        }
    }
}
